//
//  HMCarouselScrollView.m
//  HMDemo
//
//  Created by mengxiangyu on 2017/7/26.
//  Copyright © 2017年 mengxiangyu. All rights reserved.
//

#import "HMCarouselScrollView.h"
#import "HMScrollViewItem.h"
@implementation HMCarouselScrollView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.contentSize = CGSizeMake(frame.size.width*3, 0);
        self.pagingEnabled = YES;
        self.bounces = NO;
        self.backgroundColor = [UIColor whiteColor];
        self.showsVerticalScrollIndicator = NO;
        self.showsHorizontalScrollIndicator = NO;
        
        [self addSubview:self.firstView];
        [self addSubview:self.secondView];
        [self addSubview:self.thirdView];
        
    }
    return self;
}

- (UIView *)firstView {
    if (!_firstView) {
        _firstView = [[HMScrollViewItem alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    }
    return _firstView;
}
- (UIView *)secondView {
    if (!_secondView) {
        _secondView = [[HMScrollViewItem alloc] initWithFrame:CGRectMake(self.frame.size.width, 0, self.frame.size.width, self.frame.size.height)];
    }
    return _secondView;
}
- (UIView *)thirdView {
    if (!_thirdView) {
        _thirdView = [[HMScrollViewItem alloc] initWithFrame:CGRectMake(self.frame.size.width*2, 0, self.frame.size.width, self.frame.size.height)];
    }
    return _thirdView;
}


@end
